
Imports std
Imports System.IO

Module rnd

    Public Sub Main(ByVal iargs() As String)
        On Error Resume Next

        debugpause()

        Dim args As map(Of String, vector(Of String)) = Nothing
        argmgr.parse(iargs, args, True)
        Dim it As map(Of String, vector(Of String)).iterator = Nothing
        Dim min As Double = 0
        Dim max As Double = 1
        Dim intonly As Boolean = False

        Dim str As String = Nothing
        If argmgr.getfirstvalue(args, "min", str, True) Then
            min = Convert.ToDouble(str)
        End If
        If argmgr.getfirstvalue(args, "max", str, True) Then
            max = Convert.ToDouble(str)
        End If
        If argmgr.contains(args, "int") Then
            intonly = True
        End If

        Dim result As Double
        result = base.rnd(min, max, intonly, True)
        If intonly Then
            Console.WriteLine(Convert.ToInt64(result))
        Else
            Console.WriteLine(result)
        End If
    End Sub

End Module
